package com.kosugi.flickingcoin;



import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.physics.box2d.World;


public class FlickingCoin implements ApplicationListener{

	static final int WIDTH  = 320;
	static final int HEIGHT = 480;
	
    //public Shape mWorld = new Shape();
    //public Ellipse mMyCoin = new Ellipse();
    
	public World world;
	
    boolean isShapePressed = false;
    Shape dragController;    
    Shape selectedShape;
    
    private OrthographicCamera      cam;

    private Rectangle                       glViewport;
    private float                           camRotation;
    
    private Image background;
    private Image coin;
	
	@Override
	public void create() {
		// TODO Auto-generated method stub
        initShape();
        camRotation = 0f;
        
        background = new Image(512, 512, "data/background.jpg");
        coin = new Image(50, 50, "data/coin.png");
        coin.moveTo(40, 20, 0);

        cam = new OrthographicCamera(WIDTH, HEIGHT);            
        //cam.position.set(WIDTH / 2, HEIGHT / 2, 0);
        cam.position.set(0, 0, 0);

        glViewport = new Rectangle(0, 0, WIDTH, HEIGHT);

	}
	
    public void initShape() {

    }

	@Override
	public void dispose() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void render() {
		// TODO Auto-generated method stub
//		Gdx.gl.glClearColor(1, 1, 1, 1);
//		Gdx.gl.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
        GL10 gl = Gdx.graphics.getGL10();
        
        // Camera --------------------- /
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
        gl.glViewport((int) glViewport.x, (int) glViewport.y,
                        (int) glViewport.width, (int) glViewport.height);
        
        cam.update();
        cam.apply(gl);

        background.render(gl);
        // Texturing --------------------- /

        
        
        
        coin.render(gl);
	
	
	}

	@Override
	public void resize(int arg0, int arg1) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void resume() {
		// TODO Auto-generated method stub
		
	}

}
